<template>
请输入姓名：<input type="text" v-model.lazy="username" />
<div>姓名是：{{username}}</div>

<input type="text" v-model.number="num1" @change="add"></br>+
<input type="text" v-model.number="num2" @change="add"></br>={{result}}
</template>

<script setup>
import{ref} from "vue"
const username = ref("")
const num1 = ref("");
const num2 = ref("");
let result =ref (0);
function add (){
 //result.value = Number(num1.value) + Number(num2.value);
  result.value = num1.value + num2.value
}

</script>

<style>
</style>